package com.test.thread.sync;

import java.util.concurrent.TimeUnit;

public class Container {

	private String lock = "lock";

	public synchronized void f1() {
		System.out.println("f1 running...");
		try {
			TimeUnit.SECONDS.sleep(10);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public synchronized void f2() {
		System.out.println("f2 running...");
	}

	public void f3() {
		synchronized (lock) {
			System.out.println("f3 running...");
			try {
				TimeUnit.SECONDS.sleep(10);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public void f4() {
		synchronized (lock) {
			System.out.println("f4 running...");
		}
	}

	public synchronized static void f5() {
		System.out.println("f5 running...");
		try {
			TimeUnit.SECONDS.sleep(10);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public synchronized static void f6() {
		System.out.println("f6 running...");
	}
}
